cmake_minimum_required(VERSION 3.5)

get_filename_component(target_name ${CMAKE_CURRENT_LIST_DIR} NAME)

set(srv_sources "")
foreach (subfolder IN ITEMS ${THIRD_COMPONENTS})
    include_directories("${CMAKE_CURRENT_LIST_DIR}/${subfolder}/include")

    file (GLOB file_list "${CMAKE_CURRENT_LIST_DIR}/${subfolder}/*.c"
                         "${CMAKE_CURRENT_LIST_DIR}/${subfolder}/pal/*.c")
    foreach (filename IN ITEMS ${file_list})
        set(srv_sources ${srv_sources} ${filename})
    endforeach()
endforeach()

add_library("${target_name}" STATIC ${srv_sources})

# disable compile warnings
target_compile_options("${target_name}" PRIVATE -Wno-format -Wno-implicit-function-declaration)
